/*
 * 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package network;

import java.awt.Color;
import java.security.InvalidAlgorithmParameterException;
import java.security.spec.InvalidParameterSpecException;
import java.awt.Color;
import enigma.console.*;
import enigma.core.Enigma;

/**
 *
 * @author lupomobile
 * 
 */
public class Network {

    /**
     * @param args the command line arguments
     */
    private static Console s_console = Enigma.getConsole("Terminale");
    private static Thread server, client;

    public static void main(String[] args) throws InvalidParameterSpecException, InvalidAlgorithmParameterException {
        Server s1 = new Server(1234);
        Client c1 = new Client(1234);
        server = new Thread(s1);
        client = new Thread(c1);
        server.start();
        client.start();

    }

    public synchronized static void writeConsole(int t, String msg) {
        switch (t) {
            case 0:
                s_console.setTextAttributes(new TextAttributes(Color.white));
                System.out.println(msg);
                break;
            case 1:
                s_console.setTextAttributes(new TextAttributes(new Color(0, 255, 255)));
                System.out.println(msg);
                break;
            case 2:
                s_console.setTextAttributes(new TextAttributes(Color.green));
                System.out.println(msg);
                break;
            case 3:
                s_console.setTextAttributes(new TextAttributes(Color.red));
                System.out.println(msg);
                break;
            case 4:
                s_console.setTextAttributes(new TextAttributes(Color.pink));
                System.out.println(msg);
                break;

        }
    }
}
